extends Talent

func init():
	name = "弱点攻击"
func _connect():
	sys.main.connect("onBattleStart",self,"run5")
	sys.main.connect("onCharaNewChara", self, "onCharaNewChara")

func onCharaNewChara(cha):
	if cha.team == 1:
		cha.addBuff(b_weaknessAtk.new(lv))	

func run5():
	for i in sys.main.btChas:
		if i.team == 1:
			i.addBuff(b_weaknessAtk.new(lv))
#7 9 11 13 15
func get_info():
	return "我方角色(含召唤物)造成炮击伤害暴击时，额外附加[目标血上限%d%%]的伤害"%[1*lv]

class b_weaknessAtk extends "../../azurlane_ctrl/AzurBuff.gd":
	var tlv = 1
	func _init(tlv):
		attInit()
		id = "b_weaknessAtk"
		dispel = 2
		self.tlv = tlv
	func _connect():
		masCha.connect("onAtkChara",self,"_onAtkChara")
	func _onAtkChara(atkInfo):
		if atkInfo.atkType == sys.AtkType.GUN and atkInfo.isCri:
			if atkInfo.hitCha.type == sys.CharaClass.BOSS:
				atkInfo.hurtVal += atkInfo.hitCha.att.maxHp * 0.008
			else:
				atkInfo.hurtVal += atkInfo.hitCha.att.maxHp * (tlv*0.01)
